workspace: make Quarto PR preview robust (un-failable comment + correct URL on private repos)#94
Merged
Merged
Conversation
…ct URL on private repos) Two latent bugs in the reusable Quarto deploy workflow made a freshly scaffolded repo's first PR look broken (red deploy check, no/wrong preview link) even when the site published fine: 1. The preview-comment gh api read was unguarded under set -e; a transient 5xx HTML body breaks --jq and abORTS the deploy after publish. Now the block runs under set +e and closes on a guaranteed-success command. 2. The preview URL was hardcoded to <owner>.github.io/<repo>, dead on private/internal repos that serve from an obfuscated *.pages.github.io domain. Now resolved from the Pages API with fallback; deploy job and scaffold docs.yml template grant pages: read. Supersedes #91, #92, #93. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 17, 2026
When Pages isn't configured on a repo, GET /repos/{repo}/pages returns 404
and gh prints the raw error JSON to stdout instead of applying --jq, so the
previous non-empty check let that error text flow into the preview link.
Validate that the resolved base is an https URL before using it, falling back
to the canonical <owner>.github.io/<repo> form otherwise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A freshly scaffolded workspace repo's very first PR looked broken to a new user — red
docs / deploycheck, no preview link posted — even though the site published togh-pagesfine. Root cause is two latent bugs in the shared reusable workflow (workspace-quarto-site.yml), both surfaced while onboarding a freshly scaffolded private workspace repo.Bugs fixed
Transient API error reds an otherwise-successful deploy. The preview-comment
existing=$(gh api …)read was unguarded underset -e. A GitHub 5xx returns an HTML body that--jqcan't parse (invalid character '<' looking for beginning of value), aborting the step after publish succeeded. The block is documented as best-effort but wasn't. Now the whole block runs underset +eand closes on a guaranteed-success command — a comment hiccup can at most drop the comment, never red the deploy.Wrong preview URL on private/internal repos. The URL was hardcoded to
<owner>.github.io/<repo>. Private/internal repos serve Pages from an obfuscated<random>.pages.github.iodomain, so that link is dead there. Now the URL is resolved from the Pages API (.html_url) with a fallback to the canonical form; the deploy job and the scaffolddocs.ymltemplate grantpages: read.Blast radius
Both flow fleet-wide since scaffolded repos track this workflow at
@main. Existing repos get correct private-repo preview URLs after addingpages: readto theirdocs.yml(graceful fallback until then).Supersedes #92 and #93 (consolidates the preview-comment robustness work into one PR). #91 (bootstrap main first on empty repos) is a separate, complementary onboarding fix.
🤖 Generated with Claude Code